package com.insis.loadBalance;

import com.alibaba.nacos.api.naming.pojo.Instance;

import java.util.List;

public class RoundRobinRule implements LoadBalance{

    private static int current = 0;

    @Override
    public Instance getInstance(List<Instance> list) {
        int size = list.size();
        if(current == Integer.MAX_VALUE){
            current = 0;
        }
        return list.get(current++%size);
    }
}
